package createmodel

import "fmt"

type ProductC interface {
	GetProductC()
}

type ProductD interface {
	GetProductD()
}

type ConCreateProductC1 struct{}

func (p *ConCreateProductC1) GetProductC() {
	fmt.Printf("con create product C1\n")
}

type ConCreateProductD1 struct{}

func (p *ConCreateProductD1) GetProductD() {
	fmt.Printf("con create product D1\n")
}

type ConCreateProductC2 struct{}

func (p *ConCreateProductC2) GetProductC() {
	fmt.Printf("con create product C2\n")
}

type ConCreateProductD2 struct{}

func (p *ConCreateProductD2) GetProductD() {
	fmt.Printf("con create product D2\n")
}

// AbstractFactory 抽象工厂接口
type AbstractFactory interface {
	CreateProductC() ProductC
	CreateProductD() ProductD
}

// ConcreteFactory1
type ConcreteFactory1 struct{}

func (f *ConcreteFactory1) CreateProductC() ProductC {
	return &ConCreateProductC1{}
}

func (f *ConcreteFactory1) CreateProductD() ProductD {
	return &ConCreateProductD1{}
}

type ConcreteFactory2 struct{}

func (f *ConcreteFactory2) CreateProductC() ProductC {
	return &ConCreateProductC2{}
}

func (f *ConcreteFactory2) CreateProductD() ProductD {
	return &ConCreateProductD2{}
}
